from selenium.webdriver.common.by import By

from src.main.page.base_page import base_page
from selenium.webdriver.support import expected_conditions as EC

class add_page(base_page):


    def add_member(self):
        _name_input_xpath="//*[@id='username']"
        _name_value='冼喆'


        _other_name_input_xpath="//*[@class='ww_compatibleTxt ww_compatibleTxt_Small']/input"
        _other_value = '冼喆'

        _account_xpath="//*[@id='memberAdd_acctid']"
        _account_value = '冼喆'
        _telphone_xpath="//*[@class='ww_telInput']/input"
        _telphone_value = '12312312331'
        _tel_area_num_xpath="//*[@class='ww_telInput_zipCode js_countryCode_dropdown ww_btnWithMenu']//*[@class='qui_inputText ww_inputText']"
        _name_value = '冼喆'
        _email_input_xpath="//*[@id='memberAdd_mail']"
        _email_value='1151903761@qq.com'
        _save_button_xpath="//*[@class='js_member_editor_form']/*[@class='member_colRight_operationBar ww_operationBar'][2]/*[@class='qui_btn ww_btn js_btn_save']"



        _account_erro_xpath="//*[text()='账号只能由字母、数字及符号（.-_@）组成' ]"
        _phone_erro_xpath = "//*[contains(text(),'号码')]"

        name_input=self.wait.until(EC.presence_of_element_located((By.XPATH,_name_input_xpath)))
        name_input.send_keys(_name_value)

        account_input = self.wait.until(EC.presence_of_element_located((By.XPATH, _account_xpath)))
        account_input.send_keys(_name_value)

        telphone_input = self.wait.until(EC.presence_of_element_located((By.XPATH, _telphone_xpath)))
        telphone_input.send_keys(_name_value)

        email_input = self.wait.until(EC.presence_of_element_located((By.XPATH, _email_input_xpath)))
        email_input.send_keys(_email_value)

        save_button = self.wait.until(EC.presence_of_element_located((By.XPATH, _save_button_xpath)))

        save_button.click()

        print()